////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                           BailterRay                                       //
//                    Pip Robbins & Zhao Zhang                                //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
class BailterRayDmgType_Flame extends UTDamageType
	abstract;

var() ParticleSystem HitEffectParticleSystem;
var() Material OverlayMaterial;

static function SpawnHitEffect(Pawn P, float Damage, Vector Momentum, name BoneName, Vector HitLocation)
{
	local BailterRayPawn BP;

    BP = BailterRayPawn(P);

	if(BP != none)
	{
		AttachFlameEffect(BP);
	}
}

static function DoCustomDamageEffects(UTPawn ThePawn, class<UTDamageType> TheDamageType, const out TraceHitInfo HitInfo, Vector HitLocation)
{
	ThePawn.SetOverlayMaterial(default.OverlayMaterial);
}

static function AttachFlameEffect(BailterRayPawn BP)
{
	local ParticleSystemComponent PSC;
	local array<name> AllBoneNames;
	local name BoneName;

	PSC = BP.WorldInfo.MyEmitterPool.SpawnEmitter(default.HitEffectParticleSystem, BP.Location);

	if(PSC != none)
	{
		BP.Mesh.GetBoneNames(AllBoneNames);
		BoneName = AllBoneNames[Rand(AllBoneNames.length - 1)];

		PSC.SetAbsolute(false, true, false);
		BP.Mesh.AttachComponent(PSC, BoneName);
		PSC.SetTranslation(vect(0.0, 0.0, 0.0));
	}
}

defaultproperties
{
    bCausesBlood=False

    OverlayMaterial=Material'BailterRayAssetPackage.Materials.Overlay_Burnt'
	HitEffectParticleSystem=ParticleSystem'BailterRayAssetPackage.HitEffect_Burn'

}